﻿<UserControl x:Class="SubtitleTools.Shell.TranslatorView"
            xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
			 xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
			 xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
			 xmlns:i="http://schemas.microsoft.com/expression/2010/interactivity" 
			 xmlns:d="http://schemas.microsoft.com/expression/blend/2008" 
             xmlns:vm="clr-namespace:SubtitleTools.Infrastructure.ViewModels;assembly=SubtitleTools.Infrastructure"			 
             xmlns:conv="clr-namespace:SubtitleTools.Common.Converters;assembly=SubtitleTools.Common"
			 Background="#FF393939" FontFamily="Tahoma"             
			 mc:Ignorable="d" Name="ThisTranslatorView"
			 d:DesignHeight="300" d:DesignWidth="300">
    <UserControl.Resources>
        <vm:TranslatorViewModel x:Key="vmTranslatorViewModel" />
        <conv:Iso639Converter x:Key="convIso639Converter" />
        <DataTemplate x:Key="comboRow">
            <StackPanel HorizontalAlignment="Left" Orientation="Horizontal">
                <Image Width="16" Height="11" Stretch="UniformToFill"
					   Source="{Binding ISO6393166_1, Converter={StaticResource convIso639Converter}}" Margin="1" />
                <TextBlock HorizontalAlignment="Left" Text="{Binding LanguageName}" Margin="1" />
            </StackPanel>
        </DataTemplate>
    </UserControl.Resources>
    <Grid DataContext="{Binding Source={StaticResource vmTranslatorViewModel}}">
        <Grid.RowDefinitions>
            <RowDefinition Height="Auto" />
            <RowDefinition Height="Auto" />
        </Grid.RowDefinitions>
        <Grid Grid.Row="0">
            <Grid.ColumnDefinitions>
                <ColumnDefinition Width="auto" />
                <ColumnDefinition Width="*" />
            </Grid.ColumnDefinitions>
            <GroupBox Header="From" Margin="3" Grid.Column="0">
                <ComboBox 
						SelectedValue="{Binding TranslatorData.FromLanguage}"
						ItemsSource="{Binding TranslatorData.SubLanguages}"
						Width="150" HorizontalAlignment="Left" 
						ItemTemplate="{StaticResource comboRow}"
						Margin="3" />
            </GroupBox>
            <GroupBox Margin="3" Header="To" Grid.Column="1">
                <ComboBox 
						SelectedValue="{Binding TranslatorData.ToLanguage}"
						ItemsSource="{Binding TranslatorData.SubLanguages}"
						Width="150" HorizontalAlignment="Left" 
						ItemTemplate="{StaticResource comboRow}"
						Margin="3" />
            </GroupBox>
        </Grid>
        <StackPanel Grid.Row="1" Orientation="Horizontal" HorizontalAlignment="Right">
            <Button Content="Translate" 
                Command="{Binding DoTranslate}"
                CommandParameter="{Binding ElementName=ThisTranslatorView, Path=FilePath}"
                Margin="3" Height="25" Width="60" />
            <Button Content="Stop" 
                    Command="{Binding DoStopTranslation}"
                    Margin="3" Width="60"/>
            <Button Content="Cancel" 
                    Command="{Binding DoCloseTranslateView}"
                    Margin="3" Width="60"/>
        </StackPanel>
    </Grid>
</UserControl>